package com.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/hello")
public class HelloController {

    @Value("${company1}")
    private String company1;
    @Value("${company2}")
    private String company2;

    @Value("${msg1}")
    private String msg1;
    @Value("${msg2}")
    private String msg2;

    @Value("${person.name}")
    private String name;
    @Value("${person.age}")
    private Integer age;

    @Value("${address[2]}")
    private String address;

    @Value("${str}")
    private String str;


    @RequestMapping("/company")
    public String company(){
        return "hello,"+":"+company1+":"+company2;
    }

    @RequestMapping("/msg")
    public String msg(){
        System.out.println(msg1);
        System.out.println(msg2);
        return msg1+"==="+msg2;
    }

    @RequestMapping("/map")
    public String map(){
        System.out.println(name+":"+age);
        return name+":"+age;
    }

    @RequestMapping("/address")
    private String address(){
        System.out.println(address);
        return address;
    }

    @RequestMapping("/str")
    private String str(){
        System.out.println(str);
        return str;
    }
}
